package com.globant.domain;

import java.util.Date;
import java.text.ParseException;
import java.text.SimpleDateFormat;

import android.provider.BaseColumns;

import com.google.gson.annotations.SerializedName;

public class Tweet implements BaseColumns {
	
    public static final String COL_USERNAME = "fromUser";
    public static final String COL_DATE = "createdAt";
    public static final String COL_IMAGE_URL = "profileImageUrl";
    public static final String COL_TWEET = "tweet";

    @SerializedName("profile_image_url")
    private String profileImageUrl;
    
    @SerializedName("created_at")
    private String createdAt;
    
    @SerializedName("from_user")
    private String fromUser;
    
    private String text;
    
    private long id;
    
	public String getProfileImageUrl() {
		return profileImageUrl;
	}

	public void setProfileImageUrl(String profileImageUrl) {
		this.profileImageUrl = profileImageUrl;
	}

	public String getCreatedAt() {
		return createdAt;
	}

	public void setCreatedAt(String createdAt) {
		this.createdAt = createdAt;
	}

	public String getFromUser() {
		return fromUser;
	}

	public void setFromUser(String fromUser) {
		this.fromUser = fromUser;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}
	
	public String getFormattedDate() {
		SimpleDateFormat format = new SimpleDateFormat("E, dd MMM yyyy HH:mm:ss Z");
	    Date dateStr = null;
	    
		try {
			dateStr = format.parse(createdAt);
		} catch (ParseException e) {
			return "";
		}
		format = new SimpleDateFormat("dd/MM/yyyy");
		return format.format(dateStr);
	}
}
